//
//  ViewController.m
//  fakeTouchDemo
//
//  Created by 洪冬介 on 2021/12/20.
//

#import "ViewController.h"
#import "PTFakeTouch.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    UIButton* btn = [[UIButton alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
    [self.view addSubview:btn];
    [btn setTitle:@"按钮" forState:(UIControlStateNormal)];
    [btn setBackgroundColor:UIColor.yellowColor];
    [btn addTarget:self action:@selector(clickQ) forControlEvents:(UIControlEventTouchUpInside)];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    NSInteger pointId = [PTFakeTouch fakeTouchId:[PTFakeTouch getAvailablePointId] AtPoint:CGPointMake(150,150) withTouchPhase:UITouchPhaseBegan];
    [PTFakeTouch fakeTouchId:pointId AtPoint:CGPointMake(150,150) withTouchPhase:UITouchPhaseEnded];
}

- (void)clickQ{
    NSLog(@"模拟点击已触发");
    
//    NSString* originalStr = @"original string";
//    
//    NSString* base64Str = [NSString base64Encode:originalStr];
//    NSLog(@"加密后：%@", base64Str);
//    
//    NSLog(@"解密后：%@", [NSString base64Dencode:base64Str]);
}

@end
